<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" import="java.util.*,java.io.*,java.sql.*,java.text.*, dbAccess.*"%>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content
-Type" content="text/html; charset=ISO-8859-1" />
<title>Patient Create/Update Process</title>
<link rel="stylesheet" type="text/css" href="css_files/style.css" />
</head>
<body>
 <%
 //creat new patient
 Appointment apt = new Appointment(session.getAttribute("Name").toString());
 String patientId = request.getParameter("cmbPatient");
 patientId = patientId.substring(patientId.indexOf("-")+1);
   
 //tbl_appointment
 apt.setDocId(Integer.parseInt(session.getAttribute("DocId").toString()));
 apt.setPatientId(Integer.parseInt(patientId));
 String Year = request.getParameter("cmbYear").toString();
 String Month = request.getParameter("cmbMonth").toString();
 String Day = request.getParameter("cmbDate").toString();
 String d = Year + "-" + Login.monthFormat(Month) + "-" + Day;
 
 apt.setDate(d);
 apt.setStartTime(request.getParameter("txtStartTime").toString());
 apt.setEndTime(request.getParameter("txtEndTime").toString());
 apt.setBuilding(request.getParameter("txtBldg"));
 apt.setRoom(request.getParameter("txtRoom"));
 apt.setStaffId(Integer.parseInt(session.getAttribute("staffId").toString())); 
  
 if (apt.createAppointment())
 {
	 out.print(apt.getStatusMsg());
	 apt.setStatusMsg("");
 }
 else
 {
	 out.print("Failed to create appointment: " + apt.getStatusMsg());
	 apt.setStatusMsg("");
 }
   
 %>
 <form id="frmback" action="staffHome.jsp">
 <input type="submit"  name="cmdApptList" id="cmdApptList" value="Back To Staff Home"/>
 </form>

</body>
</html>